package com.sc.nft.service.impl;

import com.sc.nft.dao.ShareTheIncomeRecordDao;
import com.sc.nft.entity.ShareTheIncomeRecord;
import com.sc.nft.service.ShareTheIncomeRecordService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 分润收入记录(ShareTheIncomeRecord)表服务实现类
 *
 * @author wwc
 * @since 2023-04-21 13:46:30
 */
@Slf4j
@RequiredArgsConstructor
@Service
public class ShareTheIncomeRecordServiceImpl implements ShareTheIncomeRecordService {

    private final ShareTheIncomeRecordDao shareTheIncomeRecordDao;

    /**
     * 数据批量入库
     *
     * @param shareTheIncomeRecord
     */
    @Override
    public void batchInsert(List<ShareTheIncomeRecord> shareTheIncomeRecord) {
        shareTheIncomeRecordDao.saveBatch(shareTheIncomeRecord);
    }

    /**
     * 更新状态为已处理
     *
     * @param id
     */
    @Override
    public void theStatusWasUpdatedToProcessed(Long id) {
        ShareTheIncomeRecord shareTheIncomeRecord = new ShareTheIncomeRecord();
        shareTheIncomeRecord.setId(id);
        shareTheIncomeRecord.setStatus(1);
        shareTheIncomeRecordDao.updateById(shareTheIncomeRecord);
    }

    @Override
    public List<ShareTheIncomeRecord> ntmpleQueryAllUnprovisionedData(Integer type) {
        return shareTheIncomeRecordDao.exampleQueryAllUnprovisionedData(type);
    }

}
